package com.superb.allocation.api.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import com.baomidou.mybatisplus.annotation.TableName;
import com.superb.common.database.entity.BaseEntity;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

/**
 * 行政区划
 * @Author: ajie
 * @CreateTime: 2024-7-1
 */
@Data
@TableName("allocation_position")
@Tag(name = "行政区划")
@EqualsAndHashCode(callSuper=false)
public class AllocationPosition extends BaseEntity {

    @TableId
    @NotBlank(message = "区划CODE不能为空")
    @Schema(description = "行政区划code", requiredMode = Schema.RequiredMode.REQUIRED)
    private String id;

    @NotBlank(message = "区划名称不能为空")
    @Schema(description = "区划名称", requiredMode = Schema.RequiredMode.REQUIRED)
    private String name;

    @Schema(description = "简称")
    private String shortName;

    @NotBlank(message = "父级区划不能为空")
    @Schema(description = "父级区划", requiredMode = Schema.RequiredMode.REQUIRED)
    private String parentId;

    @Schema(title = "级别", description = "1省级2市级3区县级4乡镇街道5居委会")
    private Integer level;

    @Schema(description = "省级区划")
    private String parentTop;

    @Schema(description = "经度")
    private Double longitude;

    @Schema(description = "纬度")
    private Double latitude;

    @TableField(exist = false)
    @Schema(description = "子级行政区划")
    private List<AllocationPosition> children;

    @TableField(exist = false)
    @Schema(hidden = true)
    private String organId;
}